package com.parttime.actions;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;
import org.apache.struts2.json.annotations.JSON;
import org.apache.struts2.util.ServletContextAware;

import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
public class CommonAction extends ActionSupport implements SessionAware, ServletRequestAware, ServletResponseAware, ServletContextAware
{
	
	
	protected Map<String, Object> session;
	
	protected HttpServletRequest request;
	
	protected HttpServletResponse response;
	
	
	protected ServletContext servletcontext;
	
	protected Map<String,Object> outputData = new HashMap<String,Object>();
	
	public void setSession(Map<String, Object> arg0)
	{
		this.session = arg0;
	}
	
	public void setServletRequest(HttpServletRequest arg0)
	{
		this.request = arg0;
	}

	@Override
	public void setServletResponse(HttpServletResponse arg0) {
		this.response = arg0;
	}
	
	@Override
	public void setServletContext(ServletContext arg0) {
		this.servletcontext = arg0;
	}
	
	

	//可以修改传到页面数据的JSON参数名，出于安全性虑
	@JSON(name="Data")
	public Map<String,Object> getOutputData(){
		return outputData;
	}
	
	
	
}	
